Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Paul Xanfookonynivu 26.Sep.03 06:52 AM a Web browser
Applications Development 6.0 Windows NT


Hi All,
Here is the sample code I'd written to create dynamic xml documents in the memory.
Hope this code will be useful for beginers who wish to generate xml using LotusScript. You can modify the code as you need.

This code is created by using classes in Release 6.0.

Please feel free to write your comments.

Lotus Script Code to Generate In-Memory XML structure and reading from it
*********************************************
Option Public
Option Explicit
'Purpose of the Script.
'Sample program to show how an XML tree structure is generated
'in the Memory and walking through the in memory XML tree,instead of
'reading from the file system.
'Basic declarations.
Dim Session As NotesSession
Dim Db As NotesDatabase
Dim Coll As NotesDocumentCollection
Dim Doc As NotesDocument
'XML specific declarations.
Dim DomParser As NotesDOMParser
Dim MemoryStream As NotesStream 'The Stream generated in the memory.
Dim CorrectStream As NotesStream
Dim DomDoc As NotesDOMDocumentNode 'The Generated XML document note.
Dim ChunkData As Variant '
Dim XmlText As String
Sub Initialize
Set Session=New NotesSession
Set Db=Session.CurrentDatabase
Set Coll=Db.UnprocessedDocuments
Set Doc=Coll.GetFirstDocument
Set MemoryStream=Session.CreateStream
On Error Goto Errhandler
Call GenerateXml()
MemoryStream.Position = 0
ChunkData=MemoryStream.Read
Set CorrectStream=Session.CreateStream
Forall b In ChunkData
CorrectStream.WriteText(Chr$(b))
End Forall
CorrectStream.Position=0
XmlText=CorrectStream.ReadText
Set DomParser=Session.CreateDOMParser(XmlText)
'Now we've an XML document ready for furthur purposes like reading DTD etc.
DomParser.InputValidationOption=1 'This line explicitly looks for DTD
DomParser.process
'Now we can Navigate throught the XML document
'that is created in the memory.
Set DomDoc=DomParser.Document
Msgbox "Reading InMemory XML documents Note Type :" & Cstr(domdoc.nodetype)
Exit Sub
Errhandler:
Msgbox DomParser.log()
Exit Sub
End Sub
Sub GenerateXml()
Call MemoryStream.WriteText("<?xml version='1.0' encoding='utf-8'?>")
Call MemoryStream.WriteText("<!DOCTYPE start SYSTEM 'C:\Dxl\dominox.dtd'>")
Call MemoryStream.WriteText("<start>")
Call MemoryStream.WriteText("<body>")
Call MemoryStream.WriteText(doc.GetItemValue("Body")(0))
Call MemoryStream.WriteText("</body>")
Call MemoryStream.WriteText("<subject>")
Call MemoryStream.WriteText(doc.GetItemValue("Subject")(0))
Call MemoryStream.WriteText("</subject>")
Call MemoryStream.WriteText("</start>")
End Sub
*********************************************






Dynamic XML using LotusScript.Readi... (~Paul Xanfookon... 26.Sep.03)
. . THANK YOU!!! (but only for the clie... (~Tip Fezveluvit... 7.Oct.03)
. . RE: Dynamic XML using LotusScript.R... (~Kirk Elreterod... 26.Sep.03)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS